package com.itkaien.javaeebased.nodeexplame;


import java.util.LinkedList;

public class Node<T> {

    private T data;
    private Node<T> next;
    private Node<T> prev;

    public Node(T data) {
        this.data = data;
    }

    public Node(T data, Node<T> next) {
        this.data = data;
        this.next = next;
    }

    public Node(T data, Node<T> next, Node<T> prev) {
        this.data = data;
        this.next = next;
        this.prev = prev;
    }

    public T getData() {
        return data;
    }

    public Node<T> getNext() {
        return next;
    }

    public Node<T> getPrev() {
        return prev;
    }

    public void setNext(Node<T> next) {
        this.next = next;
    }

    public void setPrev(Node<T> prev) {
        this.prev = prev;
    }

    public static void main(String[] args) {
        Node<Integer> node = new Node<>(1);
        Node<Integer> node1 = new Node<>(2, node);
        Node<Integer> node2 = new Node<>(3, node1, node);
        System.out.println(node2.getData());
        System.out.println(node2.getNext().getData());
        System.out.println(node2.getPrev().getData());


        LinkedList<Object> objects = new LinkedList<>();
        objects.add(1);
        objects.add(2);


    }

}
